/* 
 * Copyright 2013 Sébastien Mouquet.
 * 
 * This file is part of ECovoiturage.
 * 
 * ECovoiturage is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ECovoiturage is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with ECovoiturage. If not, see http://www.gnu.org/licenses/.
 */
package com.smouquet.ecovoiturage.ui.page;

import com.smouquet.ecovoiturage.ui.Wizard;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

/**
 * Vue pour l'installation de l'application.
 * 
 * @author sebastien.mouquet
 */
public class InstallView extends VerticalLayout implements View
{
    public static final String VIEW_NAME = "install";
    
    
    public InstallView()
    {
        setSizeFull();
    }
    

    @Override
    public void enter(ViewChangeEvent event)
    {
        Wizard wizard = new Wizard("Installation");
        wizard.setClosable(false);
        wizard.setModal(true);
        wizard.setWidth(500, Unit.PIXELS);
        wizard.setHeight(300, Unit.PIXELS);
        
        wizard.addStep(new InstallWizardConfigStep());
        wizard.addStep(new InstallWizardDatabaseStep());
        wizard.addStep(new InstallWizardUserAdminStep());
        wizard.start();
        
        for(Window w : getUI().getWindows()) {
            getUI().removeWindow(w);
        }
        getUI().addWindow(wizard);
    }
    
}
